package com.gmail.jaredjeya.awesomeplatformer;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

import com.gmail.jaredjeya.awesomeplatformer.view.Dialogs;
import com.gmail.jaredjeya.awesomeplatformer.view.GameView;

public class MainActivity extends Activity {

	LinearLayout linear;
	GameView view;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.v("AwesomeDebug", "Activity Started");
		setContentView(R.layout.activity_main);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		linear = (LinearLayout) findViewById(R.id.linear1);
		LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		view = new GameView(MainActivity.this);
		view.setLayoutParams(params);
		linear.addView(view);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.game_menu, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
			case R.id.quit_menuItem:
				this.finish();
				return true;
			case R.id.options_menuItem:
				Dialogs.options(MainActivity.this);
				return true;
			case R.id.help_menuItem:
				Dialogs.help(MainActivity.this, 0);
				return true;
			case R.id.about_menuItem:
				Dialogs.about(MainActivity.this);
				return true;
			default:
				return super.onOptionsItemSelected(item);
		}
	}

}
